﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Languages;
using PTUDW_CNTN2010_F_CDT.Constant;
using System.ComponentModel.DataAnnotations.Schema;

namespace PTUDW_CNTN2010_F_CDT.Models
{
    public class Customer
    {
        [ScaffoldColumn(false)]
        public int CustomerId { get; set; }

        [Key]
        [Required(ErrorMessageResourceName = "UserNameRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(ConstValue.UserNameMinLength, ErrorMessageResourceName = "UserNameSoShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.UserNameMaxLength, ErrorMessageResourceName = "UserNameSoLong", ErrorMessageResourceType = typeof(Resources))]
        //[RegularExpression("", ErrorMessageResourceName = "UserNameExpression", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "UserName", ResourceType = typeof(Resources))]
        public string UserName { get; set; }


        [Required(ErrorMessageResourceName = "PasswordRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(ConstValue.PasswordMinLength, ErrorMessageResourceName = "PasswordTooShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.PasswordMaxLength, ErrorMessageResourceName = "PasswordTooLong", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        [Display(Name = "Password", ResourceType = typeof(Resources))]
        public string Password { get; set; }

        [Required(ErrorMessageResourceName = "EmailRequired", ErrorMessageResourceType = typeof(Resources))]
        //[RegularExpression("", ErrorMessageResourceName = "EmailExpression", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "EmailAddress", ResourceType = typeof(Resources))]
        [DataType(DataType.EmailAddress, ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(Resources))]
        public string Email { get; set; }

        [Required(ErrorMessageResourceName = "FullNameRequired", ErrorMessageResourceType = typeof(Resources))]
        //[RegularExpression("", ErrorMessageResourceName = "FullNameExpression", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "FullName", ResourceType = typeof(Resources))]
        public string FullName { get; set; }

        [Required(ErrorMessageResourceName = "SexRequired", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "Sex", ResourceType = typeof(Resources))]
        public bool Sex { get; set; }

        [MaxLength(100, ErrorMessageResourceName = "AddressTooLong", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "Address", ResourceType = typeof(Resources))]
        public string Address { get; set; }


        [DataType(DataType.PhoneNumber)]
        [Display(Name = "PhoneNumber", ResourceType = typeof(Resources))]
        public string Phone { get; set; }


        [ScaffoldColumn(false)]
        [Display(Name="Status", ResourceType = typeof(Resources))]
        public bool IsActive { get; set; }

        [ScaffoldColumn(false)]
        [Display(Name = "Status", ResourceType = typeof(Resources))]
        public bool IsAdmin { get; set; }

        [ScaffoldColumn(false)]
        [Display(Name="ProvinceId", ResourceType = typeof(Resources))]
        public int ProvinceId { get; set; }

        [ScaffoldColumn(false)]
        public int Level { get; set; }
        
        public virtual Province Province { get; set; }
    }
}